package com.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.Interfacese.SearchByUserName;
import com.actionForm.UserActionForm;
import com.biz.UserMessageHandle;
import entities.Users;
import com.factory.ProduceObject;

public class ShowUserAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		HttpSession hs=request.getSession();
		ProduceObject po = new ProduceObject();
		SearchByUserName sbun = po.produceUserMessageHandle();
		String name = hs.getAttribute("userName").toString();
		Users user=sbun.searchByName(name);
		System.out.println(user.getName());
		request.setAttribute("user",user);
		return mapping.findForward("showUser");
	}

}
